﻿/// <summary>
/// https://leetcode-cn.com/problems/median-of-two-sorted-arrays/submissions/
/// </summary>
public class Solution
{
    public double FindMedianSortedArrays(int[] nums1, int[] nums2)
    {
        var len = nums1.Length + nums2.Length;
        var lenD2 = len / 2;
        return len % 2 == 0 ?
             nums1.Concat(nums2).OrderBy((num) => num).Skip(lenD2 - 1).Take(2).Sum() / 2D :
             nums1.Concat(nums2).OrderBy((num) => num).Skip(lenD2).First();
    }
}